﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace NetC
{
    public partial class NetConnection : Form
    {
        public NetConnection()
        {
            InitializeComponent();

        }


        private void InfoForm_Load(object sender, EventArgs e)
        {
            /*
            Screen[] screens = Screen.AllScreens;
            Screen screen = screens[0];
            this.Location = new Point(screen.WorkingArea.Width - 170, screen.WorkingArea.Height - 40);//设置起始位置。相对坐标为右下角
             */
            //this.Size = new Size(167, 193);
            //this.Height = 0;
            this.SetDesktopLocation(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 177, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 33);
            this.timer2.Interval = staytime;
           
        }


         public void scrollshow()
        {
            //this.Width = 0;
            this.Height = 0;
            this.Show();
            this.timer1.Enabled = true;
        }

        public int staytime = 5600;

        private void scrollup()
        {
            if (this.Height < 150)//消息框的最高高度
            {
                this.Height += 3;
                this.Location = new Point(this.Location.X, this.Location.Y - 3);

            }
            else
            {
                this.timer1.Enabled = false;
                this.timer2.Enabled = true;

            }

         }

        private void scrolldowm()
        {
            if (this.Height > 37)
            {
                this.Height -= 3;
                this.Location = new Point(this.Location.X, this.Location.Y + 3);

            }
            else
            {
                this.timer3.Enabled = false;
                this.Close();
                //this.Dispose();
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            scrollup();
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Enabled = false;
            timer3.Enabled = true;
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            scrolldowm();
        }
  

    
    }
}
